#ifndef MemoryManagement_h
#define MemoryManagement_h

#include "Memory.h"
#include "resource.h"
#include "PageReplacementManager.h"
#include "Configuration.h"

class MemoryManager
{
public:
	MemoryManager(Configuration* conf);
	~MemoryManager();

	byte* read(int vAddr, int ammount);
	void write(int vAddr, const byte c[]);
	int createProcess();
	int deleteProcess(int id);
	int contextSwitch(int id);

	void printUserMM();
	void printKernelMM();
	void printMMUTable();

	double getUserHitRate();
	double getKernelHitRate();

private:
	int pid;
	Memory* m_MM;
	Memory* m_Disk;
	PageReplacementManager* m_PageReplacementManager;
	Configuration* m_conf;
	MemoryManagementUnit* m_mmu;
	PCBS* m_processes;
	int m_numOfProcesses;
	int m_numOfKernelPerProcess;
	int m_numOfUserPerProcess;
	int m_numOfEntries;
	PCB* m_currProcess;
	int getPage(int vAddr);
	void resetPage(int pageNum);
};

#endif
